package com.base.cn.platform.os.service.course.cou.packageCou;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 套餐与课程的关联的接口
 *
 * @author s.li
 * @create 2018-05-02-16:03
 */
@FeignClient(name =  CourseBaseService.appName,configuration = FeignAuthConfig.class)
public interface PackageCourseService extends CourseBaseService {

    /**
     * 创建阶段
     * @param packageId 套餐ID
     * @param stageContext 阶段内容
     */
    @RequestMapping(contextPath + "/createStage")
    Map<String,Object> createStage(@RequestParam("packageId") BigDecimal packageId,
                                   @RequestParam("stageContext") String stageContext);

    /**
     * 保存套餐与课程的关联
     * @param parentId 父ID（阶段ID）
     * @param packageId 套餐ID
     * @param courseIds 添加的课程ID串
     */
    @RequestMapping(contextPath + "/savePackageCourse")
    Map<String,Object> savePackageCourse(@RequestParam(value = "parentId", required = false, defaultValue = "0") BigDecimal parentId,
                                         @RequestParam("packageId") BigDecimal packageId,
                                         @RequestParam("courseIds") String courseIds);

    /**
     * 删除套餐与课程的关联数据
     * @param packageId 套餐ID
     * @param ids 记录ID串
     */
    @RequestMapping(contextPath + "/deletePackageCourse")
    Map<String,Object> deletePackageCourse(@RequestParam("packageId") BigDecimal packageId,
                                           @RequestParam("ids") String ids);

    /**
     * 修改套餐与课程关联的价格
     * @param id 记录ID
     * @param price 新的价格
     */
    @RequestMapping(contextPath + "/updatePackageCoursePrice")
    Map<String,Object> updatePackageCoursePrice(@RequestParam("id") BigDecimal id,
                                                @RequestParam("price") Double price);

    /**
     * 修改套餐与课程关联的排序
     * @param id
     * @param sort
     * @return
     */
    @RequestMapping(contextPath + "/updatePackageCourseSort")
    Map<String,Object> updatePackageCourseSort(@RequestParam("id") BigDecimal id,
                                               @RequestParam("sort") Integer sort);

    /**
     * 修改套餐与课程关联的必须状态
     * @param id 记录ID
     * @param required 1.必选 2.非必选
     */
    @RequestMapping(contextPath + "/updatePackageCourseRequired")
    Map<String,Object> updatePackageCourseRequired(@RequestParam("id") BigDecimal id,
                                                   @RequestParam("required") int required);

    /**
     * 查询套餐下关联的课程数据列表
     * @param packageId 套餐ID
     * @param setCourseData 是否设置课程，true设置，false不设置
     * @return List<PackageCourse>
     */
    @RequestMapping(contextPath + "/findPackageCourseByPackageId")
    List<Map<String,Object>> findPackageCourseByPackageId(@RequestParam("packageId") BigDecimal packageId,
                                                          @RequestParam("setCourseData") boolean setCourseData);

    /**
     * 查询套餐下的课程目录
     * @param userId 用户ID
     * @param packageId 套餐ID
     * @param setCourseData  是否设置课程数据
     * @return Map<Integer,List<PackageCourse>>
     */
    @RequestMapping(contextPath + "/findUserLayeredPackageCourseByPackageId")
    Map<Integer,List<Map<String,Object>>> findUserLayeredPackageCourseByPackageId(@RequestParam("userId") BigDecimal userId,
                                                                                  @RequestParam("packageId") BigDecimal packageId,
                                                                                  @RequestParam("setCourseData") boolean setCourseData);

    /**
     * 查询套餐下关联的课程数据列表(分层)
     * @param packageId 套餐ID
     * @param setCourseData 是否设置课程，true设置，false不设置
     * @return List<PackageCourse>
     */
    @RequestMapping(contextPath + "/findLayeredPackageCourseByPackageId")
    Map<Integer,List<Map<String,Object>>> findLayeredPackageCourseByPackageId(@RequestParam("packageId") BigDecimal packageId,
                                                                              @RequestParam("setCourseData") boolean setCourseData);
}
